package com.lcc.forum.demos.web.exception;

import com.lcc.forum.demos.web.common.AppResult;
//自定义异常
public class ApplicationException extends RuntimeException{
    //在异常中持有一个错误信息对象
    protected AppResult errorResult;

    public AppResult getErrorResult() {
        return errorResult;
    }

    //自定义构造方法
    public ApplicationException(AppResult errorResult){
        super(errorResult.getMessage());//以实现打印的是ApplicationException类
        this.errorResult = errorResult;
    }

    //重写父类方法
    public ApplicationException(String message) {
        super(message);
    }

    public ApplicationException(String message, Throwable cause) {
        super(message, cause);
    }

    public ApplicationException(Throwable cause) {
        super(cause);
    }


}
